﻿package plugin.newxunbao.handler
{
    import cmd.*;
    import com.core.*;
    import flash.utils.*;
    import pluginfw.nio.*;
    import pluginfw.nio.imsg.*;

    public class NewXunbaoHandler extends Object implements IGroupHandler
    {

        public function NewXunbaoHandler()
        {
            return;
        }// end function

        public function dealSimpleMessage(param1:ISimpleMessage) : void
        {
            var _loc_2:Object = null;
            switch(param1.getCmd())
            {
                case CMDXunBao.OpenEgg:
                {
                    ModelProxy.change("xunbao", "OpenEgg", param1.getParam());
                    ModelProxy.change("mainui", "changeswf", {key:"xb", flag:false});
                    break;
                }
                case CMDXunBao.GetEggsLog:
                {
                    ModelProxy.change("xunbao", "GetEggsLog", param1.getParam());
                    break;
                }
                case CMDXunBao.ShouChong:
                {
                    ModelProxy.change("shouchong", "getshouchong", "");
                    _loc_2 = UserData.getOnlineData();
                    _loc_2.shouchong = 1;
                    break;
                }
                case CMDXunBao.getShoucong:
                {
                    _loc_2 = UserData.getOnlineData();
                    _loc_2.shouchong = 2;
                    ModelProxy.change("mainui", "refreshShouChongBtn", null);
                    ModelProxy.change("mainui", "shouchongget", null);
                    break;
                }
                case CMDXunBao.getClientReward:
                {
                    ModelProxy.change("mainui", "removeBtn", "weiduandenglu");
                    _loc_2 = UserData.getOnlineData();
                    _loc_2.getclient = 1;
                    ModelProxy.change("mainui", "wdreward", null);
                    ModelProxy.change("mainui", "wdgd", null);
                    break;
                }
                default:
                {
                    break;
                    break;
                }
            }
            return;
        }// end function

        public function dealBufferMessage(param1:IBufferMessage) : void
        {
            var _loc_2:Object = null;
            var _loc_3:Input = null;
            var _loc_4:ByteArray = null;
            var _loc_5:Object = null;
            switch(param1.getCmd())
            {
                case CMDXunBao.Worldlevel2:
                {
                    _loc_2 = new Object();
                    _loc_3 = new Input(null);
                    _loc_4 = param1.getBody();
                    _loc_4.position = 0;
                    _loc_3.setBytes(_loc_4);
                    _loc_2.worldlevel = _loc_3.readVarInt(false);
                    ModelProxy.change("data", "worldlevel", _loc_2.worldlevel);
                    _loc_5 = UserData.getUserData("level");
                    if (_loc_2.worldlevel > _loc_5 + 10)
                    {
                        ModelProxy.change("bufferView", "addBindBuffer", "worldlevel");
                    }
                    ModelProxy.change("shop", "worldlevel", null);
                    break;
                }
                default:
                {
                    break;
                }
            }
            return;
        }// end function

        public function dealProxyMessage(param1:IProxyMessage) : void
        {
            return;
        }// end function

    }
}
